#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<cstdio>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define ll long long
#define pi acos(-1)
const int maxn = 1e6+5;


int m,l;   //题目输入 
char s[maxn];  //输入的字符串

int ans;   //存答案
int len;   //字符串长度 

map<long long,int>mp;   //  存哈希 

/*----单哈希参数-----*/
ll base = 29;
ll mod = 1e9+7;
ll hhash[maxn],p[maxn];


signed main()
{
	while(~scanf("%d%d",&m,&l))
	{
		scanf("%s",s+1);
		len = strlen(s+1);
		ans = 0;
		p[0] = 1;
		hhash[0] = 0;
		
		for(int i=1;i<=len;++i)   //计算哈希值 
		{
			hhash[i] = (hhash[i-1]*base + s[i]-'a'+1)%mod;
			
			p[i] = (p[i-1]*base)%mod;
		}
		
		for(int i=1;i<=l&&i+m*l<=len;++i)   //暴力遍历字符串 
		{
			for(int j=i;j<i+m*l;j+=l)   //枚举m个长为l的子串
			{
				//区间[l,r]对应的哈希值:
                //ll res = ((hash[r]-hash[l-1]*p[r-l+1])%mod+mod)%mod;
                //r-l+1 = j+l-1-l+1 = l
				ll res = (hhash[j+l-1]-hhash[j-1]*p[l]%mod+mod)%mod;
				
				++mp[res];
			}
			
			if(mp.size()==m) ++ans;
			
			for(int j=i+m*l;j+l-1<=len;j+=l)   // 枚举剩余的字符串
			{
				ll res = (hhash[j+l-1]-hhash[j-1]*p[l]%mod+mod)%mod;
				
				++mp[res];
				
				
				//这里我的理解是只要从ma中存过的随便取出一个哈希值即可 
				res = (hhash[j+l-1-m*l]-hhash[j-1-m*l]*p[l]%mod+mod)%mod;  //取出一个哈希值
				--mp[res];
				
				if(!mp[res]) mp.erase(res);
				
				if(mp.size()==m) ++ans; 
			}
			
			mp.clear();
		}
		
		printf("%d\n",ans);
	}
	return 0;
}
